package com.example.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author ljw
 * @version 1.0
 * @Date 2024/8/18 12:54
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
    private Integer code;//业务状态码 200成功 500失败
    private String message;
    private T data;
    public static <E> Result<E> success(E data){
        return new Result<>(200,"操作成功",data);
    }
    public static Result success(){return new Result(200,"操作成功",null);}
    public static Result error(String message){return new Result(500,message,null);}
    public static Result error(){return new Result(500,"操作失败",null);}
}
